package dao;

import domain.User;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import util.JDBCUtils;

import java.util.List;


public class UserDaoImpl implements UserDao{
    private JdbcTemplate template = new JdbcTemplate(JDBCUtils.getDataSource());

    public List<User> getUserByName(String name) {
        String sql = "select * from news_users where uname = ?";
        List<User> userList = template.query(sql, new BeanPropertyRowMapper<User>(User.class), "admin");
        return userList;
    }
}
